package cc.lj.internal.merchant.interfaces.facade;

import cc.lj.internal.merchant.MerchantApp;
import cc.lj.internal.merchant.infrastructure.exception.MerchantExceptionEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * 查询错误码接口
 * @author liangxifeng
 * @date 2021-12-30
 */
@RestController
@Api(tags = "查看本项目所有错误码接口")
public class ShowErrorCodeController {
    @GetMapping("/errorCode")
    @ApiOperation(value = "查看所有错误码")
    public List<String> getErrorCode()
    {
        List<String> list = new ArrayList<>();
        for(MerchantExceptionEnum e: MerchantExceptionEnum.values())
        {
            String item = e.getCode()+"--"+e.getMessage();
            list.add(item);
        }
        return list;
    }
}
